<%@ Page Language="C#" AutoEventWireup="true" CodeFile="test2.aspx.cs" Inherits="test2" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
    
    <script language=javascript type="text/javascript">            
        function Enter(e)
        {
            var keynum;
            keynum = e.keyCode;
            //Si la tecla es un enter (13). Limpia el texto
            if (keynum == 13)
            {                    
                document.getElementById('txtLeido').value = document.getElementById('txtLeido').value + "\n" + document.getElementById('Text1').value;
                document.getElementById('Text1').value = "";
                document.getElementById('Text1').focus();
            }                
        }
        
        function NoPostBack()
        {
            if (window.event.keyCode == 13) 
            {
                event.returnValue=false; 
                event.cancel = true;
            }
        }
    </script>
    
</head>
<body onkeydown="NoPostBack();">
    <form id="form1" runat="server">
    <div>        
        <input id="Text1" type="text" onkeydown="Enter(event);" /><br />
        <asp:TextBox ID="txtLeido" runat="server" Rows="5" TextMode="MultiLine"></asp:TextBox><br />
        <asp:Label ID="lblMsg" runat="server"></asp:Label><br />
        &nbsp;<asp:Button ID="btnEnviar" runat="server" OnClick="btnEnviar_Click" Text="Enviar" /></div>
    </form>
</body>
</html>
